
#include "../source/serve.hpp"
#include <string.h>
int main()
{
    Socket cilent;
    cilent.CreateClient("127.0.0.1", 8089);
    // int count = 0;
    // while (true)
    // {
    //     // std::cout << "============================" << std::endl;
    //     count++;
    //     const char *data = "Hello World";
    //     // std::cout << "============================" << std::endl;
    //     cilent.Send(data, strlen(data));
    //     // std::cout << "============================" << std::endl;
    //     char buffer[1024];
    //     // std::cout << "============================" << std::endl;
    //     ssize_t len = cilent.Recv(buffer, 1023);
    //     // std::cout << "============================" << std::endl;
    //     buffer[len] = 0;
    //     INF_LOG("recv:%s,count%d", buffer, count);
    //     sleep(1);
    // }

    for (int i = 0; i < 5; i++)
    {
        std::string data = "Hello World";
        cilent.Send(data.c_str(), data.size());
        char buffer[1024];
        ssize_t len = cilent.Recv(buffer, 1023);
        buffer[len] = 0; 
        DBG_LOG("serve say:%s", buffer);
        sleep(1);
    }

    while (1)
    {
        sleep(1);
    }
    return 0;
}